<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" id="viewport" content="width=320, target-densitydpi=1, user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta name="format-detection" content="telephone=no">
		<link rel="shortcut icon" href="images/favicon.ico">
		<title>宋宫汝瓷客服授权书</title>
		<style>
			body,
			h1,
			h2,
			h3,
			h4,
			h5,
			h6,
			p,
			input {
				margin: 0;
				padding: 0;
				font-size: 13px;
				font-family: "微软雅黑";
			}
			
			ul,
			ol,
			dl,
			li,
			dt,
			dd {
				list-style-type: none;
				margin: 0;
				padding: 0;
				font-family: "微软雅黑"
			}
			
			a {
				text-decoration: none;
				color: #333333;
			}
			
			a:hover {
				text-decoration: none;
				color: #980600;
			}
			
			.clear {
				clear: both;
				overflow: hidden;
			}
			
			img {
				border: none;
			}
			
			body {
				background: #FFF;
			}
			
			.wrap {
				margin: 2%;
			}
			@media (min-width: 640px) {
				.wrap {
					width: 640px;
					margin: 0 auto;
				}
				
			}
			.zhengshu{
				width: 100%;
			}
		</style>

		<body>
			<div class="wrap">
				<canvas  id='myCanvas'  width="1372" height='1937'></canvas>
			</div>
			<div class="wrap" >
				<img id="zhengshu" class="zhengshu"/>
			</div>
		</body>
		<script type="text/javascript">
		var o = document.getElementById("zhengshu");
		var widths = o.offsetWidth;
		var heights = widths*1937/1372; //高度
		  var code=localStorage.getItem('code'); 
		  var name=localStorage.getItem('name'); 
		  var weixin=localStorage.getItem('weixin'); 
		  if(code&&name&&weixin){
		  getImg(name,code,weixin,45,1372,1937)
		  }
		  function getImg(name,code,weixin,fsz,width,height){
			   var c = document.getElementById("myCanvas");
			   var cxt = c.getContext("2d");
			   var img = new Image();
			   img.src = 'images/wx_sqbg.png';
			   img.onload=function(){//图片加载完成，才可处理
			      cxt.drawImage(img,0,0,width,height);
			       cxt.save();
			      cxt.font = fsz+"px SumSun";
			      cxt.textBaseline = 'middle';//更改字号后，必须重置对齐方式，否则居中麻烦。设置文本的垂直对齐方式
			        cxt.textAlign = 'left';
				 cxt.fillStyle="black";
				 cxt.fillText(name,width*190/975,height*43/100);//文本元素在画布居中方式
				 cxt.fillStyle="black";
				 cxt.fillText(weixin,width*65/100,height*43/100);//文本元素在画布居中方式
			     cxt.fillStyle="red";
			     cxt.fillText(code,width*35/100,height*400/686);//文本元素在画布居中方式
			   }; 
			   c.style="width:"+widths+"px;height: "+heights+"px;"
			} 
		</script>
</html>